package com.zgjkhis.modules.charges.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @Author yzq
 * @Description 发票
 * @Date 2021/6/23 9:38
 * @Param
 * @return
 **/
@Data
@TableName("his_invoice")
public class Invoice implements Serializable {

    @TableId
    private Long id;
    @ApiModelProperty(value = "开票人姓名",required = true)
    @NotNull(message = "开票人姓名不能为空")
    private String username;
    @ApiModelProperty(value = "收费项目",required = true)
    @NotNull(message = "收费项目不能为空")
    private String project;
    @ApiModelProperty(value = "收费金额",required = true)
    @NotNull(message = "收费金额不能为空")
    private String money;
    @ApiModelProperty(value = "开票时间",required = true)
    @NotNull(message = "开票时间不能为空")
    private String openTime;
    @ApiModelProperty(value = "收款人",required = true)
    @NotNull(message = "收款人不能为空")
    private String collectionUser;
    @ApiModelProperty(value = "创建人id")
    private String createUserId;
    @ApiModelProperty(value = "创建人名称")
    private String createUserName;
    @ApiModelProperty(value = "打印次数")
    private Integer printingTimes;
    /** 创建时间 */
    @TableField(fill= FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;



    @ApiModelProperty(value = "药房id",required = true)
    @NotNull(message = "药房id不能为空")
    private String pharmacyId;

    public void copy(Invoice source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
